package org.example.k8s_cloudplatform.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.example.k8s_cloudplatform.entity.User;

import java.util.List;

public interface UserMapper extends BaseMapper<User> {
    @Select("select max(id) " +
            "from user")
    Integer getMaxId();

    /**
     * 根据搜索条件查询用户ID列表
     *
     * @param search 搜索条件
     * @return 匹配条件的已激活普通用户ID列表
     */
    @Select("SELECT id " +
            "FROM user " +
            "WHERE id LIKE CONCAT(#{search},'%') and job = 0 and status = 0")
    List<Integer> selectIDBySearch(@Param("search") String search);
}